<template>
    <div class="header">
        <div class="nav">
            <div
                v-for="(item, index) in navList"
                :key="index"
                class="nav-list"
                :class="{ active: item.type == clickIndex }"
                @click="navClick(item)"
            >
                <span class="nav-title">{{ item.name }}</span>
            </div>
        </div>
        <div class="header_center">
            <dv-border-box-13 style="padding: 12px; text-align: center">
                优亲贝贝大数据展示
            </dv-border-box-13>
            <!-- <img
                src="../../assets/img/xiaozhu-katong.png"
                alt=""
                class="logo-img"
            /> -->
        </div>
    </div>
</template>

<script>
export default {
    name: "navList",
    data() {
        return {
            navList: [
                {
                    name: "首页",
                    type: 1,
                    img: "../../../public/static/images/nav_1.png",
                },

                {
                    name: "经销商排名",
                    type: 2,
                    img: "../../../public/static/images/nav_2.png",
                },

                {
                    name: "门店排名",
                    type: 3,
                    img: "../../../public/static/images/nav_2.png",
                },
            ],
        };
    },
    props: ["clickIndex"],
    methods: {
        navClick(item) {
            // this.clickIndex = item.type;
            if (item.type === 1) {
                this.$router.push("/homeIndex");
            } else if (item.type === 2) {
                this.$router.push("/inviteIndex");
            } else if (item.type === 3) {
                this.$router.push("/storeIndex");
            }
        },
    },
};
</script>

<style scoped>
.header {
    width: 100%;
    height: 80px;
    background-color: #030829;
    padding: 0 15px;
    /*display: flex;*/
    /*align-items: center;*/
    /*justify-content: flex-start;*/
}
.nav-list {
    display: inline-block;
    width: 120px;
    text-align: center;
    height: 50px;
    position: relative;
    line-height: 50px;
    margin-top: 15px;
    box-sizing: border-box;
    border-radius: 5px;
    cursor: pointer;
}
.header_center {
    display: flex;
    align-items: center;
    color: #ffffff;
    background-image: url("/assets/images/logoBg.png");
    background-size: cover;
    font-size: 28px;
    font-weight: bold;
    margin-right: 30px;
}
.active {
    border-bottom: 4px solid #4b8df8;
    box-shadow: -10px 0px 15px #034c6a inset, 0px -10px 15px #034c6a inset,
        10px 0px 15px #034c6a inset, 0px 10px 15px #034c6a inset;
    box-sizing: border-box;
}
.nav-title {
    color: #ffffff;
    font-size: 14px;
}

.logo-img {
    object-fit: cover;
    width: 69px;
    height: 72px;
}
</style>